<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>vue06</title>
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
		<style>
			.link{
				color: blueviolet;
				text-decoration: none;
				cursor: pointer; // 光标呈现为指示链接的指针（一只手）
			}
			.active{
				color: red;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<a class="link" v-bind:class="classObj" v-bind:href="url">{{url}}</a><br /> <br />
			<a :style="[styleObj, isActive ? activeStyle : '']" v-bind:class="classObj" v-bind:href="url">{{url}}</a><br /> <br />
		</div>
		<script type="text/javascript">
			var vm = new Vue({
				el:"#app",
				data:{
					protocal: 'http:',
					host: 'www.qq.com',
					isActive: false,
					styleObj:{color: 'bule' },
					activeStyle:{color: 'red' }
				},
				computed:{
					url: function(){
						return this.protocal + "//" + this.host;
					},
					
					classObj: function(){
						return {
							active: this.isActive,
						}
					}
				}

			});
		</script>

	</body>
</html>
